<%@ page contentType="text/html;charset=UTF-8" language="java"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1 user-scalable=0">
<title>购物车</title>
<link rel="stylesheet" href="<%=basePath%>assets/css/reset.css">
<link rel="stylesheet" href="<%=basePath%>assets/css/page.css">
<link href="<%=basePath%>/assets/layer/mobile/need/layer.css"
	rel="stylesheet" type="text/css">
<link rel="stylesheet" href="<%=basePath%>assets/css/public.css">
<link rel="stylesheet"
	href="<%=basePath%>assets/font-awesome-4.7.0/css/font-awesome.min.css">
<script src="<%=basePath%>/assets/layer/mobile/layer.js"></script>
<script src="<%=basePath%>assets/js/fontSize.js"></script>
<script src="<%=basePath%>assets/js/jquery-1.8.3.min.js"></script>
<script src="<%=basePath%>assets/js/page.js"></script>
<script src="<%=basePath%>assets/js/textNumber.js"></script>
<style type="text/css">
body {
	padding-bottom: 1rem;
	padding-top: 0.8rem;
}
.noSJ {
	width: 100%;
}

.noSJ img {
	width: 50%;
	margin: 30% auto 10%;
	display: block
}

.noSJ h3 {
	width: 100%;
	font-size: 0.25rem;
	line-height: 0.6rem;
	font-weight: bold;
	text-align: center;
	color: #000
}

.noSJ p {
	width: 100%;
	font-size: 0.24rem;
	line-height: 0.6rem;
	text-align: center
}

.shopping_car_list>li>.choose.y, .shopping_bar2>div>.choose.y, .address>li .tool>.choose.y
	{
	background: #FF3F25 url(../images/g.png) no-repeat center;
	background-size: 9px auto;
	border: 1px solid #FF3F25;
}

.shopping_bar2 {
	width: 100%;
	height: 44px;
	background: rgba(255, 255, 255, 255);
	position: fixed;
	left: 0;
	bottom: 0.8rem;
	font-size: 14px;
	color: #454545;
	line-height: 44px;
	border-top: 1px solid #f1f1f1;
	z-index: 10000;
	border-bottom: 1px solid #f1f1f1
}

.shopping_bar2>div {
	height: 44px;
	width: 35px;
	position: absolute;
	padding-left: 35px;
	top: 0;
	left: 0;
	border-right: 1px solid #f1f1f1;
}

.shopping_bar2>p {
	padding-left: 80px;
}

.shopping_bar2>p>span {
	color: #FF3F25;
}

.shopping_bar2>p>span i {
	font-size: 18px;
}

.shopping_bar2>a {
	position: absolute;
	width: 100px;
	height: 44px;
	line-height: 44px;
	text-align: center;
	font-size: 14px;
	text-decoration: none;
	background: #FF3F25;
	color: #fff;
	top: 0;
	right: 0;
}


/*头部*/
.title a {
	font-size: 0.24rem;
	display: block;
	line-height: 1.8em;
	padding: 0.1rem;
}
.title a i {
	margin-left: 0.1rem;
}

/*编辑/完成切换*/
.bj {
	position: absolute;
	font-size: 0.2rem;
	top: 0;
	right: 0.2rem;
	color: #FF3F25;
}

.wc {
	position: absolute;
	font-size: 0.2rem;
	top: 0;
	right: 0.2rem;
	display: none
}

/*每个商家的li为一个卡片*/
.shopping_car_list {
	padding: 10px 0 44px 0;
}
.shopping_car_list > li {
	background: #fff;
	border-bottom: 2px solid #E9E9E9;
    border-right: 2px solid #E9E9E9;
	position: relative;
	margin: 0.2rem;
    box-shadow: 0 0 0.2rem #E5E5E5;
    border-radius: 0.1rem;
}
.box2,.box {
	position: relative;
	height: 0;
    padding-bottom: 32%;
}
/*单选按钮*/
.choose_box{
	width: 10%;
	height: 0;
	padding-bottom: 40%;
	position: absolute;
	top: 0;
	left: 0;
}
.choose {
	width: 0.24rem;
	height: 0.24rem;
	border-radius: 50%;
	background: #fff;
	border: 1px solid #d7d7d7;
	position: absolute;
	top: 35%;
	left: 0.15rem;
}
/*商品详情*/
.goods_details{
	width: 90%;
	height: 0;
	padding-bottom: 24%;
	position: absolute;
	top: 0;
	left: 10%;
}
.goods_img{
	width: 30%;
	height: 0;
	margin-top: 5%;
	padding-bottom: 26%;
	background-size: 140%;
    background-position: 20% 20%;
    background-repeat: no-repeat;
    overflow: hidden;
/*     border-radius: 0.1rem */
}
.text{
	font-size: 0.2rem;
	position: absolute;
    top: 20%;
    left: 32%;
    line-height: 0.32rem;
    padding-right: 0.2rem;
    font-size: 0.22rem;
}
.goodsSize{
	font-size: 0.18rem;
	position: absolute;
    top: 50%;
    left: 32%;
    line-height: 0.32rem;
    padding-right: 0.2rem;
    color: #9e8686;
}
/*数据操作*/
.num {
	position: absolute;
	right: 0.2rem;
	bottom: 0.2rem;
/* 	height: 1rem; */
	text-align: right;
}
.num>span {
	color: #FF3F25;
	display: inline-block;
	width: 13px;
	height: 13px;
	border-radius: 4px;
	background: #fff;
	border: 1px solid #E9E9E9;
	position: relative;
	vertical-align: middle;
}
.num input {
	display: inline-block;
	border: 0;
	width: 2em;
	text-align: center;
	height: 17px;
	line-height: 17px;
	vertical-align: middle;
	font-size: 0.24rem;
}
.num .add:before {
	content: "";
	position: absolute;
	top: 2px;
	bottom: 2px;
	left: 6px;
	width: 1px;
	background: #FF3F25;
}
.num .add:after, .num .cut:after
	{
	content: "";
	position: absolute;
	top: 6px;
	left: 2px;
	right: 2px;
	height: 1px;
	background: #FF3F25;
}
/*价格*/
.price {
	position: absolute;
	bottom: 7%;
    left: 38%;
	color: #FF3F25;
	line-height: 0.4rem;
	font-size: 0.2rem;
}
.price .fa{
	font-size: 0.2rem;
	margin-right: 0.1rem;
}
.price i {
	font-size: 0.22rem;
}

/*失效宝贝*/
.choose_n {
    line-height: 0.26rem;
    border-radius: 2px;
    text-align: center;
    color: #ACACAC;
    width: 0.42rem;
    height: 0.24rem;
    position: absolute;
    top: 35%;
    left: 0.12rem;
    font-size: 0.1rem;
}
.choose_n:after {
	content: "失效";
}
.sx {
	position: absolute;
	bottom: 0;
	right: 0.2rem;
	font-size: 0.2rem;
	color: #ACACAC;
	line-height: 0.4rem;
}
.sxText{
	color: #ACACAC;
}
.shopping_car_list>li>.box .choose.y {
	background: #FF3F25 url(../images/g.png) no-repeat center;
	background-size: 9px auto;
	border: 1px solid #FF3F25;
}
.shopping_car_list>li>h2>.choose {
	width: 0.2rem;
	height: 0.2rem;
	border-radius: 9px;
	background: #fff;
	border: 1px solid #d7d7d7;
	position: absolute;
	left: 10px;
}
.shopping_car_list>li>.box2>.choose_n {
	background: #d4d4d4;
	width: 2.5em;
	font-size: 10px;
	height: 16px;
	line-height: 19px;
	border-radius: 2px;
	position: absolute;
	left: -35px;
	margin-top: 36px;
	text-align: center;
	color: #fff;
}
.shopping_car_list>li>.box2>.choose_n:after {
	content: "失效";
}

.shopping_cart a .img{
    display: none;
}
.shopping_cart a .img2{
    display: block;
}
.shopping_cart a p{
    color: #FF3F25;
}

</style>

<script>
	$(function() {
		$('.shopping_car_list').find('li').each(function() {
			$(this).find('.box').each(function() {
				var textHtml = $(this).find('.text').text();
				$(this).find('.text').text(showText(textHtml, 31))
			})
			$(this).find('.box2').each(function() {
				var textHtml = $(this).find('.text').text();
				$(this).find('.text').text(showText(textHtml, 31))
			})
		})
	})
</script>
</head>
<body>
	<input id="basePath" type="hidden" value="<%=basePath%>">
	<div class="header">
		<span>购物车</span>
		<c:if test="${not empty shoppingList}">
			<span class="bj">编辑</span>
			<span class="wc">完成</span>
		</c:if>
	</div>
	<c:choose>
		<c:when test="${not empty shoppingList}">
			<ul class="shopping_car_list" id="goods">
				<c:forEach items="${shoppingList}" var="shoppingList">
					<li>
						<h2 class="title border-bottom-1">
							<a href="<%=basePath%>app/goodsList?merchantId=${shoppingList.merchantId}"
								class="clearFirx"> ${shoppingList.merchantName} <i
								class="fa fa-angle-right"></i>
							</a>
						</h2> <c:forEach items="${shoppingList.shoppingGoodsList}"
							var="shoppingGoodsList">
							<c:choose>
								<c:when
									test="${(shoppingGoodsList.isSale eq '0' || shoppingGoodsList.state eq '0')}">
									<div class="box2 del">
										<div class="choose_box">
											<span class="choose_n delChoose"></span> 
										</div>
										<a href="<%=basePath%>app/toGoodsInfo?goodsId=${shoppingGoodsList.goodsId}" class="goods_details">
											<div class="goods_img" style="background-image: url(<%=basePath%>app/getGoodsPhotoByName?goodsImage=${shoppingGoodsList.goodsThums});"></div>
											<p class="text sxText">${shoppingGoodsList.goodsName}</p>
										</a> <span class="sx">商品已下架</span> <input class="goodsId"
											type="hidden" value="${shoppingGoodsList.goodsId}"></input> <input
											class="check" type="hidden" value="0"></input>
									</div>
								</c:when>
								<c:when
									test="${shoppingGoodsList.orderCount gt shoppingGoodsList.goodsStock}">
									<c:choose>
										<c:when test="${shoppingGoodsList.goodsStock le 0}">
											<div class="box2 del">
												<div class="choose_box">
													<span class="choose_n delChoose"></span> 
												</div>
												<a href="<%=basePath%>app/toGoodsInfo?goodsId=${shoppingGoodsList.goodsId}" class="goods_details">
													<div class="goods_img" style="background-image: url(<%=basePath%>app/getGoodsPhotoByName?goodsImage=${shoppingGoodsList.goodsThums});"></div>
													<p class="text sxText">${shoppingGoodsList.goodsName}</p>
												</a> <span class="sx">商品无库存</span> <input class="goodsId"
													type="hidden" value="${shoppingGoodsList.goodsId}"></input> <input
													class="check" type="hidden" value="0"></input>
											</div>
										</c:when>
										<c:otherwise>
											<div class="box2 del">
												<div class="choose_box">
													<span class="choose_n delChoose"></span> 
												</div>
												<a href="<%=basePath%>app/toGoodsInfo?goodsId=${shoppingGoodsList.goodsId}" class="goods_details">
													<div class="goods_img" style="background-image: url(<%=basePath%>app/getGoodsPhotoByName?goodsImage=${shoppingGoodsList.goodsThums});"></div>
													<p class="text sxText">${shoppingGoodsList.goodsName}</p>
												</a> 
												<p class="num">
														<span class="cut"></span> 
														<input readonly type="text" value="${shoppingGoodsList.orderCount}"> 
														<span class="add"></span>
												</p>
												<span class="price">￥<i>${shoppingGoodsList.unitPrice}</i></span>
												<span class="sx">商品库存不足</span>
												<input class="goodsId" type="hidden" value="${shoppingGoodsList.goodsId}"/>
												<input class="check" type="hidden" value="0"/>
												<input class="unitPrice" type="hidden" value="${shoppingList.unitPrice}"/>
											</div>
										</c:otherwise>
									</c:choose>
								</c:when>
								<c:otherwise>
									<div class="box">
										<div class="choose_box">
											<span class="choose"></span> 
										</div>
										<a href="<%=basePath%>app/toGoodsInfo?goodsId=${shoppingGoodsList.goodsId}" class="goods_details">
											<div class="goods_img" style="background-image: url(<%=basePath%>app/getGoodsPhotoByName?goodsImage=${shoppingGoodsList.goodsThums});"></div>
											<p class="text">${shoppingGoodsList.goodsName}</p>
											<c:if test="${not empty shoppingGoodsList.goodsSize}">
												<p class="goodsSize">规格：${shoppingGoodsList.goodsSize}</p>
											</c:if>
										</a>
										<p class="num">
											<span class="cut"></span> 
											<input readonly type="text" value="${shoppingGoodsList.orderCount}"> 
											<span class="add"></span>
										</p>
										<span class="price">￥<i>${shoppingGoodsList.unitPrice}</i></span>

										<input class="goodsId" type="hidden" value="${shoppingGoodsList.goodsId}"/>
										<input class="check" type="hidden" value="0"/>
										<input class="unitPrice" type="hidden" value="${shoppingList.unitPrice}"/>
									</div>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</li>

				</c:forEach>
			</ul>

			<div class="shopping_bar2">
				<div>
					<span class="choose"></span>全选
				</div>
				<p class="hj">
					合计 <span id="total_price"> ￥<i>0.00</i></span>
				</p>
				<a class="js" onclick="jiesuan()">结算</a> <a class="yrsc"
					style="display: none; margin-right: 100px; background-color: #ffac28; color: #ffffff;">移入收藏</a>
				<a class="sc" style="display: none">删除</a>
			</div>
		</c:when>
		<c:otherwise>
			<div class="noSJ">
				<img src="<%=basePath%>assets/images/bcz.png" alt="">
				<h3>您的购物车空空如也,请购买一些商品吧~</h3>
			</div>
		</c:otherwise>
	</c:choose>
	<%@ include file="footer.jsp"%>
</body>
<script type="text/javascript">
	$(document).ready(function() {

		var goodsIds = "";
		$('.shopping_car_list').find('.box').each(function() {
			goodsIds += $(this).find('.goodsId').val() + ","
		})

		$.ajax({
			url : $("#basePath").val() + "app/checkShoppingCard",
			timeout : 300000,
			dataType : "json",
			type : "post",
			data : {
				"goodsIds" : goodsIds,
				"userCheck" : 0
			}
		})
		init();
	})

	function init() {
		// 选择
		$('.shopping_car_list').find('.choose').on('click',function() {
					if ($(this).parent().siblings('.check').val() == 0) {
						$(this).parent().siblings('.check').val(1);
					} else {
						$(this).parent().siblings('.check').val(0);
					}
					$.ajax({
						url : $("#basePath").val() + "app/checkShoppingCard",
						timeout : 300000,
						dataType : "json",
						type : "post",
						data : {
							"goodsIds" : $(this).parent().siblings('.goodsId').val(),
							"userCheck" : $(this).parent().siblings('.check').val()
						}
					})

					$(this).toggleClass('y');
					//全选的判断
					if ($('.shopping_car_list').find('.choose').length == $(
							'.shopping_car_list').find('.choose.y').length) {
						$('.shopping_bar2').find('.choose').addClass('y');
					} else {
						$('.shopping_bar2').find('.choose').removeClass('y');
					}
					total();
				});

		// 增加减少数量
		$('.shopping_car_list').find('.num').find('.cut').click(function() {
			var val = $(this).siblings('input').val();
			if (val <= 1){
				layer.open({
					content : '该宝贝不能减少了哦~',
					skin : 'msg',
					time : 2
				//2秒后自动关闭
				});
				return;
			}
// 			if (val > 1) {
// 				val -= 1;
// 			}
			val -= 1;
			$(this).siblings('input').val(val);
			$.ajax({
				url : $("#basePath").val() + "app/checkShoppingCard",
				timeout : 300000,
				dataType : "json",
				type : "post",
				data : {
					"goodsIds" : $(this).parent('.num').siblings('.goodsId').val(),
					"unitPrice" : $(this).parent('.num').siblings('.unitPrice').val(),
					"orderCount" : val
				}
			})
			if(typeof($(this).parent('.num').siblings('.sx').html()) != "undefined"){
				var goodsId = $(this).parent('.num').siblings('.goodsId').val();
				var goodsStock;
				var unitPrice;
				$.ajax({
					url : $("#basePath").val() + "app/getAppGoodsInfo",
					dataType : "json",
					type : "post",
					async : false,
					data : {
						"goodsId" : goodsId,
					},
					success : function(data) {
						goodsStock = data.goodsStock;
						unitPrice = data.unitPrice;
					}
				})
				if(goodsStock>=val){
					$(this).parent('.num').parent('.del').removeClass("box2");
					$(this).parent('.num').parent('.del').addClass("box");
					$(this).parent('.num').parent('.del').find('.delChoose').removeClass("choose_n");
					$(this).parent('.num').parent('.del').find('.delChoose').addClass("choose");
					$(this).parent('.num').parent('.del').find('.choose').removeClass("delChoose");
					$(this).parent('.num').parent('.del').removeClass("del");
					$(this).parent('.num').parent('.box').find('.choose').on('click',function() {
						if ($(this).parent().siblings('.check').val() == 0) {
							$(this).parent().siblings('.check').val(1);
						} else {
							$(this).parent().siblings('.check').val(0);
						}
						$.ajax({
							url : $("#basePath").val() + "app/checkShoppingCard",
							timeout : 300000,
							dataType : "json",
							type : "post",
							data : {
								"goodsIds" : $(this).parent().siblings('.goodsId').val(),
								"userCheck" : $(this).parent().siblings('.check').val()
							}
						})

						$(this).toggleClass('y');
						//全选的判断
						if ($('.shopping_car_list').find('.choose').length == $(
								'.shopping_car_list').find('.choose.y').length) {
							$('.shopping_bar2').find('.choose').addClass('y');
						} else {
							$('.shopping_bar2').find('.choose').removeClass('y');
						}
						total();
					});
					$(this).parent('.num').siblings('.sx').remove();						}
			}
			total();

		});

		$('.shopping_car_list').find('.add').click(function() {
			var val = $(this).siblings('input').val();
			val++;

			var goodsId = $(this).parent('.num').siblings('.goodsId').val();
			var unitPrice = $(this).parent('.num').siblings('.unitPrice').val()
			var goodsStock;
			$.ajax({
				url : $("#basePath").val() + "app/getAppGoodsInfo",
				dataType : "json",
				type : "post",
				async : false,
				data : {
					"goodsId" : goodsId,
				},
				success : function(data) {
					goodsStock = data.goodsStock
				}
			})
			if (val > goodsStock) {
				layer.open({
					content : '库存不足,亲~',
					skin : 'msg',
					time : 2
				//2秒后自动关闭
				});
			} else {
				$(this).siblings('input').val(val);
				$.ajax({
					url : $("#basePath").val() + "app/checkShoppingCard",
					timeout : 300000,
					dataType : "json",
					type : "post",
					data : {
						"goodsIds" : goodsId,
						"unitPrice" : unitPrice,
						"orderCount" : val
					}
				})
				total()
			}

		});

		// 全选
		$('.shopping_bar2').find('.choose').click(function() {
			var check = 0;
			$(this).toggleClass('y');
			if ($(this).hasClass('y')) {
				check = 1;
				$('.shopping_car_list .choose').addClass('y');
			} else {
				check = 0;
				$('.shopping_car_list .choose').removeClass('y');
			}
			total();

			var goodsIds = "";
			$('.shopping_car_list').find('.box').each(function() {
				$(this).find('.check').val(check);
			})
			$('.shopping_car_list .box > .choose_box > span.y').each(function() {
				goodsIds += $(this).parent().siblings('.goodsId').val() + ","
			})
			$.ajax({
				url : $("#basePath").val() + "app/checkShoppingCard",
				timeout : 300000,
				dataType : "json",
				type : "post",
				data : {
					"goodsIds" : goodsIds,
					"userCheck" : check
				}
			})
		});

		//编辑全部
		$('.bj').click(function() {
			$(".bj").css("display", "none");
			$(".hj").css("display", "none");
			$(".js").css("display", "none");
			$(".wc").css("display", "block");
			$(".sc").css("display", "block");
			$(".yrsc").css("display", "block");
			$(".del").removeClass("box2");
			$(".del").addClass("box");
			$(".del .delChoose").removeClass("choose_n");
			$(".del .delChoose").addClass("choose");
			$('.shopping_car_list').find('.del .choose').on('click',function() {
				if ($(this).parent().siblings('.check').val() == 0) {
					$(this).parent().siblings('.check').val(1);
				} else {
					$(this).parent().siblings('.check').val(0);
				}
				$(this).toggleClass('y');
				$.ajax({
					url : $("#basePath").val() + "app/checkShoppingCard",
					timeout : 300000,
					dataType : "json",
					type : "post",
					data : {
						"goodsIds" : $(this).parent().siblings('.goodsId').val(),
						"userCheck" : $(this).parent().siblings('.check').val()
					}
				})
			});
		})
		//完成
		$('.wc').click(function() {
			$(".wc").css("display", "none");
			$(".sc").css("display", "none");
			$(".yrsc").css("display", "none");
			$(".hj").css("display", "block");
			$(".js").css("display", "block");
			$(".bj").css("display", "block");
			$(".del").removeClass("box");
			$(".del").addClass("box2");
			$(".del .delChoose").removeClass("choose");
			$(".del .delChoose").addClass("choose_n");
			$('.shopping_car_list').find('.del .choose_n').off("click");
			$('.shopping_car_list').find('.del .choose_n').each(function(){
				if ($(this).parent().siblings('.check').val() == 1) {
					$(this).removeClass('y');
					$(this).parent().siblings('.check').val(0);
					$.ajax({
						url : $("#basePath").val() + "app/checkShoppingCard",
						timeout : 300000,
						dataType : "json",
						type : "post",
						data : {
							"goodsIds" : $(this).parent().siblings('.goodsId').val(),
							"userCheck" : $(this).parent().siblings('.check').val()
						}
					})
				}
			});
		})
		//删除
		$('.sc').click(
				function() {
					var goodsIds = "";
					$('.shopping_car_list .box > .choose_box > span.y').each(function() {
						goodsIds += $(this).parent().siblings('.goodsId').val() + ","
					})
					if (goodsIds == null || goodsIds == '') {
						layer.open({
							content : '请选择需要删除的商品，亲~',
							skin : 'msg',
							time : 2
						//2秒后自动关闭
						});
					} else {
						$.ajax({
							url : $("#basePath").val() + "app/delShoppingCard",
							timeout : 300000,
							dataType : "json",
							type : "post",
							data : {
								"userCheck" : 1,
								"goodsIds" : goodsIds
							},
							success : function(data) {
								if (data.state == 1) {
									layer.open({
										content : '删除成功',
										skin : 'msg',
										time : 2
									//2秒后自动关闭
									});
									window.location.href = $("#basePath").val()
											+ "app/getShoppingCardList";
								} else {
									layer.open({
										content : '删除出现了问题，请稍等亲~',
										skin : 'msg',
										time : 2
									//2秒后自动关闭
									});
								}
							}
						})
					}
				});
		//移入收藏
		$('.yrsc').click(
				function() {
					var goodsIds = "";
					$('.shopping_car_list .box > .choose_box > span.y').each(function() {
						goodsIds += $(this).parent().siblings('.goodsId').val() + ","
					})
					if (goodsIds == null || goodsIds == '') {
						layer.open({
							content : '请选择需要移入收藏的商品，亲~',
							skin : 'msg',
							time : 2
						//2秒后自动关闭
						});
					} else {
						$.ajax({
							url : $("#basePath").val() + "app/toMyCollect",
							timeout : 300000,
							dataType : "json",
							type : "post",
							data : {
								"goodsIds" : goodsIds
							},
							success : function(data) {
								if (data == 1) {
									layer.open({
										content : '移入收藏成功',
										skin : 'msg',
										time : 2
									//2秒后自动关闭
									});
									window.location.href = $("#basePath").val()
											+ "app/getShoppingCardList";
								} else {
									layer.open({
										content : '移入收藏出现了一点小问题，请稍等亲~',
										skin : 'msg',
										time : 2
									//2秒后自动关闭
									});
								}
							}
						})
					}
				});

	}

	// 价格及购物车数量
	function total() {
		var totalPrice = 0;
		$('#goods li .box span.y')
				.each(
						function() {
							var goodsNum = $(this).parent().siblings('.num').children(
									'input').val(), goodsPrice = $(this).parent().siblings('.price').text().substring(1);

							totalPrice += parseFloat((goodsNum * goodsPrice)
									.toFixed(2));

						});
		$('#total_price i').text(totalPrice.toFixed(2));
	}
	function jiesuan() {
		if ($('#total_price i').text() == "0.00") {
			layer.open({
				content : '请选择商品,亲~',
				skin : 'msg',
				time : 2
			//2秒后自动关闭
			});
			return false;
		}
		window.location.href = $("#basePath").val() + "app/userAffirmOrder";
	}
</script>
</html>